home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmCallDlls
- BorderStyle = 1 'Fixed Single
- Caption = "Right Mouse"
- ClientHeight = 3750
- ClientLeft = 1455
- ClientTop = 1665
- ClientWidth = 5505
- ClipControls = 0 'False
- Height = 4155
- Left = 1395
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 3750
- ScaleWidth = 5505
- Top = 1320
- Width = 5625
- Begin Image Image1
- Height = 1695
- Left = 0
- Top = 2040
- Width = 5535
- End
- Begin Image ImgArea
- Height = 2055
- Index = 0
- Left = 0
- Top = 0
- Width = 2655
- End
- Begin Image ImgArea
- Height = 2055
- Index = 1
- Left = 2640
- Top = 0
- Width = 2895
- End
- Begin Menu mnuTest
- Caption = "Test"
- Visible = 0 'False
- Begin Menu mnuTest1
- Caption = "Test1"
- End
- Begin Menu mnuTest2
- Caption = "Test2"
- End
- Begin Menu mnuTest3
- Caption = "Test3"
- End
- Begin Menu mnuTest4
- Caption = "Test4"
- End
- End
- Option Explicit
- Sub Form_Load ()
- Show ' Make sure this form has an hWnd, etc.
- Load frmMenus
- End Sub
- Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
- End
- End Sub
- Sub Image1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
- If Button = 2 Then
- frmcallDlls.PopupMenu mnutest
- End If
- End Sub
- Sub ImgArea_MouseDown (index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'The index grabs the control index of control array
- 'Button grabs which button clicked
- 'True false if Shift key down
- Dim IX As Integer
- Dim IY As Integer
- Dim hMenu As Integer
- Dim hSubMenu As Integer
- Dim R As Integer 'response variable for DLL call
- Dim menRect As Rect 'Establishes boundary for right click
- If Button And 2 Then 'Compares two Bitpos with and (eg 2 and 2 equal True)
- ScaleMode = TWIPS
- menRect.Left = 0 'Establishes boundary for right click
- menRect.Top = 0 'Establishes boundary for right click
- menRect.Right = Screen.Width / Screen.TwipsPerPixelX 'Establishes boundary for right click
- menRect.Bottom = Screen.Height / Screen.TwipsPerPixelY 'Establishes boundary for right click
- IX = (X + frmcallDlls.Left + imgarea(index).Left) \ Screen.TwipsPerPixelX
- IY = (Y + frmcallDlls.Top + imgarea(index).Top + (frmcallDlls.Height - frmcallDlls.ScaleHeight)) \ Screen.TwipsPerPixelY
- hMenu = GetMenu(frmMenus.hWnd) 'Get menu from form
- hSubMenu = GetSubMenu(hMenu, index) 'Create a drop down submenu
- R = TrackPopupMenu(hSubMenu, 2, IX, IY, 0, frmMenus.hWnd, menRect)
- End If
- End Sub
-